package com.max.eshop.UI.userinterface;

import java.util.ArrayList;
import java.util.List;

public class Builder {

	private List<Menu> allMenu = new ArrayList<Menu>();

	public Menu getFirstMenu() {
		return allMenu.get(0);
	}
public void svazi(){
	allMenu.get(0).getButtons().get(0).setNextMenu(allMenu.get(1));
	allMenu.get(0).getButtons().get(1).setNextMenu(allMenu.get(2));
	allMenu.get(0).getButtons().get(2).setNextMenu(allMenu.get(3));
	allMenu.get(1).getButtons().get(0).setNextMenu(allMenu.get(4));
	allMenu.get(1).getButtons().get(1).setNextMenu(allMenu.get(5));
	allMenu.get(1).getButtons().get(2).setNextMenu(allMenu.get(6));
	allMenu.get(1).getButtons().get(3).setNextMenu(allMenu.get(7));
	allMenu.get(1).getButtons().get(6).setNextMenu(allMenu.get(8));
	allMenu.get(1).getButtons().get(7).setNextMenu(this.getFirstMenu());
}
	public void buildMenu() {
		List<Button> menu = new ArrayList<Button>();
		menu.add(new Button("Show Data",Action.next,null));
		menu.add(new Button("Dobavitb",Action.next,null));
		menu.add(new Button("Ydalitb",Action.next,null));
		menu.add(new Button("vipolnitb", Action.executeOrder,null));
		menu.add(new Button("Vihod", Action.exit,null));		
		allMenu.add(new Menu(menu));// 0 Start Menu
		menu= new ArrayList<Button>();
		menu.add(new Button("Books", Action.next,null));
		menu.add(new Button("Orders", Action.next,null));
		menu.add(new Button("Reqests",Action.next,null));
		menu.add(new Button("ExecuteOrders", Action.next,null));
		menu.add(new Button("SumMoney",Action.summ,null));
		menu.add(new Button("CountExecuteOrder",Action.count,null));
		menu.add(new Button("StaleBooks", Action.next,null));
		menu.add(new Button("Back", Action.Back,null));
		allMenu.add(new Menu(menu));// 1 Show Data/podmenu
		menu = new ArrayList<Button>();
		menu.add(new Button("Book", Action.addBook, null));
		menu.add(new Button("Order",  Action.addOrder, null));
		menu.add(new Button("Back",Action.Back, null));
		allMenu.add(new Menu(menu));// 2 Dobavitb/podmenu
		menu = new ArrayList<Button>();
		menu.add(new Button("Book", Action.deleteBook, null));
		menu.add(new Button("Order",  Action.deleteOrder, null));
		menu.add(new Button("Back", Action.Back, null));
		allMenu.add(new Menu(menu));// 3 Ydalitb/podmenu
		menu = new ArrayList<Button>();
		menu.add(new Button("Alphabet", Action.alphabetBook, null));
		menu.add(new Button("Count", Action.countBook, null));
		menu.add(new Button("Price",Action.priceBook, null));
		menu.add(new Button("DateOfPublication",Action.dateBook, null));
		menu.add(new Button("Back", Action.Back, null));
		allMenu.add(new Menu(menu));// 4 Show Data/podmenu Books/podmenu
		menu = new ArrayList<Button>();
		menu.add(new Button("Date", Action.dateOrders, null));
		menu.add(new Button("Price", Action.priceOrders, null));
		menu.add(new Button("Status", Action.statusOrders, null));
		menu.add(new Button("Back",Action.Back, null));
		allMenu.add(new Menu(menu));// 5 Show Data/podmenu Orders/podmenu
		menu = new ArrayList<Button>();
		menu.add(new Button("Alphabet", Action.alphabetReqest, null));
		menu.add(new Button("Count",Action.countReqest, null));
		menu.add(new Button("Back", Action.Back, null));
		allMenu.add(new Menu(menu));// 6 Show Data/podmenu Reqests/podmenu
		menu = new ArrayList<Button>();
		menu.add(new Button("Date", Action.dateExecuteOrder, null));
		menu.add(new Button("Count", Action.countExecuteOrder, null));
		menu.add(new Button("Back",Action.Back, null));
		allMenu.add(new Menu(menu));// 7 Show Data/podmenu ExecuteOrders/podmenu
		menu = new ArrayList<Button>();
		menu.add(new Button("DateOfReceipt",Action.dateStaleBooks, null));
		menu.add(new Button("Price", Action.priceStaleBooks, null));
		menu.add(new Button("Back",Action.Back, null));
		allMenu.add(new Menu(menu));// 8 Show Data/podmenu StaleBooks/podmenu
		this.svazi();
	}
}
